# -*- coding:utf8 -*- #
# -----------------------------------------------------------------------------------
# ProjectName:   platform-ul-auto-test
# FileName:     MD5
# Author:      
# Datetime:    2022/05/6 11:22
# Description：
# -----------------------------------------------------------------------------------
import hashlib


def group(username, password):
    reversed_username = username[::-1]
    password_md5 = username + reversed_username + password
    return password_md5


def md5_1(username="13618013781", password="123123"):
    password_md5 = group(username, password)
    md = hashlib.md5()
    md.update(password_md5.encode('utf-8'))  # update括号内必须是byte类型
    return md.hexdigest()


def md5_2(username="13618013781", password="123123"):
    password_md5 = group(username, password)
    md = hashlib.md5(password_md5.encode('utf-8')).hexdigest()
    return md


def md5_3(username="13618013781", password="123123"):
    password_md5 = group(username, password)
    md = hashlib.new('md5', password_md5.encode('utf-8')).hexdigest()
    return md


if __name__ == '__main__':
    print("1：" + md5_1())
    print("2：" + md5_2())
    print("3：" + md5_3())
